#include <iostream>
#include <exception>
using namespace std;

// 抛出自定义的异常

class Myerror: public exception
{
public:
    // 重写父类的同名虚函数what()
    const char * what() const throw()
    {
        // 处理异常
        cout << "函数调用失败"<< endl;
        return "出错";
    }
};

int func(int n)
{
    Myerror err;
    if (n >= 10 && n <= 100)
    {
        return 0;
    }
    else if (n > 100)
    {
        throw err;
    }
    else
    {
        throw 1.12;
    }
}

int main()
{
    Myerror err;

    int n;
    cin >> n;
    try
    {
        func(n);
        cout << "运行成功" << endl;
    }
    catch (Myerror e)
    {
        cout << "捕捉到Myerror的异常: " << e.what() << endl;
    }
    catch (double e)
    {
        cout << "捕捉到浮点型异常: " << e << endl;
    }


    return 0;
}